import React,{useState,useEffect,useContext} from 'react';
import User from './user'
import {UserContext} from '@/pages/function/context/userContext';
import {Button} from 'antd-mobile'
export default function(props){
  const {state,dispatch} = useContext(UserContext)

  useEffect(()=>{},[])

  const handleLogin=()=>{
    dispatch({
      type:'LOGIN',
      payload:true
    })
  }
  return(
    <div>
      {state.isLogin?<User />:<Button type='primary' onClick={handleLogin}>登录</Button> }
    </div>
  )
}
